/*
 * Created: Author: Aléx Carvalho / Date: May 14, 2015
 * 
 * Changed: $Author: ac280593@gmail.com $ / $Date: 2015-06-11 01:28:43 -0300 (Thu, 11 Jun 2015) $
 */
package com.cpm.entities.converters;

import com.cpm.entities.types.IndicatorPeriodicity;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

@Converter(autoApply = true)
public class IndicatorPeriodicityPersistenceConverter implements AttributeConverter<IndicatorPeriodicity, Integer> {

    @Override
    public Integer convertToDatabaseColumn(IndicatorPeriodicity attribute) {
        return TypeConverter.getId(attribute);
    }

    @Override
    public IndicatorPeriodicity convertToEntityAttribute(Integer dbData) {
        return TypeConverter.convertTo(IndicatorPeriodicity.class, dbData);
    }
}
